package Lesson4;

import java.util.Arrays;
import java.util.Scanner;

public class Class5TaskTen {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		System.out.println("Please enter the length of the array");
		int n = sc.nextInt();
		int[] arr = new int [n];
		
		int comp = 0;
		int t = 0;
		int c = 0;
		
		int a;
		System.out.print("The random numbers are: ");
		for(int i = 0; i<arr.length; i++)
		{
			a = (int)(Math.random()*(n-1));
			System.out.print(a+ " ");
			arr[a] +=1;
		}
		System.out.println();
		
		for(int i = 0; i < arr.length; i++)
		{
			if(arr[i]> c)
			{
				c = arr[i];
				comp = i;
				t = arr[i];
			}
			
		}
		
		System.out.println( "There are most " + comp + " (" + t + " times)");
	}

}
